<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>新增</button>
    <ul></ul>
    <div>
        总和为:
        <span id="total">0</span>
    </div>
    <script src="../lib/jquery.min.js"></script>
    <script>
        const nums = [];
        let total = 0;
        $('button').on('click', () => {
            const num = Math.floor(Math.random() * 10);
            total += num;
            const el = $(`<li>${num}</li>`);
            $('ul').append(el);
            $('#total').text(total);
        });


    </script>
</body>
</html>